if(CONFIG_PJON)
zephyr_interface_library_named(PJON)

zephyr_compile_definitions_ifdef(CONFIG_PJON_MAX_PACKETS PJON_MAX_PACKETS=CONFIG_PJON_MAX_PACKETS)
zephyr_compile_definitions_ifdef(CONFIG_PJON_PACKET_MAX_LENGTH PJON_PACKET_MAX_LENGTH=CONFIG_PJON_PACKET_MAX_LENGTH)
zephyr_compile_definitions_ifdef(CONFIG_PJON_INCLUDE_PORT PJON_INCLUDE_PORT)
zephyr_compile_definitions_ifdef(CONFIG_PJON_INCLUDE_MAC PJON_INCLUDE_MAC)

target_include_directories(PJON INTERFACE ../src)



if(CONFIG_PJON_STRATEGY_THROUGHSERIAL)
target_compile_definitions(PJON INTERFACE
TS_INITIAL_DELAY=CONFIG_TS_INITIAL_DELAY
TS_COLLISION_DELAY=CONFIG_TS_COLLISION_DELAY
TS_RESPONSE_TIME_OUT=CONFIG_TS_RESPONSE_TIME_OUT
TS_TIME_IN=CONFIG_TS_TIME_IN
TS_BYTE_TIME_OUT=CONFIG_TS_BYTE_TIME_OUT
TS_MAX_ATTEMPTS=CONFIG_TS_MAX_ATTEMPTS
TS_BACK_OFF_DEGREE=CONFIG_TS_BACK_OFF_DEGREE
TS_RS485_DELAY=CONFIG_TS_RS485_DELAY
TS_FLUSH_OFFSET=CONFIG_TS_FLUSH_OFFSET
TS_READ_INTERVAL=CONFIG_TS_READ_INTERVAL)
endif()

if(CONFIG_PJON_STRATEGY_DUALUDP)

target_compile_definitions(PJON INTERFACE
DUDP_RESPONSE_TIMEOUT=CONFIG_DUDP_RESPONSE_TIMEOUT
DUDP_MINIMUM_SEND_INTERVAL_MS=CONFIG_DUDP_MINIMUM_SEND_INTERVAL_MS
DUDP_MAX_RETRIES=CONFIG_DUDP_MAX_RETRIES
DUDP_MAX_REMOTE_NODES=CONFIG_DUDP_MAX_REMOTE_NODES
DUDP_MAX_FAILURES=CONFIG_DUDP_MAX_FAILURES)

endif()


endif()
